-
-
Notifications
You must be signed in to change notification settings - Fork 860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support desktop (click and drag) rotation #1592
Conversation
Co-Authored-By: Ian <[email protected]> Co-Authored-By: Guillaume Roux <[email protected]>
I only included the round function as that was in the original solution I was looking at. I never had chance to do any detailed digging into whether it causes any issues without it. I did ponder it at the time and couldn't really figure why it was necessary. |
Moved `InteractionOptions.enableScrollWheel` to `InteractiveFlags.scrollWheelZoom` (with deprecation) Improved documentation of `InteractiveFlags`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just got some very minor remarks, otherwise LGTM! 👍
Thank you very much for adding in this feature! I've tested it just now on the demo page here: For me it works mostly fine, but I noticed the rotation jumps around a little bit in unexpected ways (maybe I don't have the correct expectations?)... Here are some reproduction steps of the issue in case this helps:
It appears wherever the mouse is dragged to relative to the center of the map view becomes the new north of the map. @JaffaKetchup Is this how it's expected to work? I would have expected the map rotation to allow us to "Drag" the map for rotation by a few degrees at once, not set the new north. |
Hi @androidseb, |
Resolves #1568.
Thanks to @TesteurManiak for the infrastructure implementation and POC and @ibrierley for the rotation algorithm itself. Also thanks to https://stackoverflow.com/questions/48916517/javascript-click-and-drag-to-rotate and https://github.com/openlayers/openlayers/blob/7099f14bd2348491c1550f7b0be929e5da00d83d/src/ol/interaction/DragRotate.js#L65.
Still to do before this can be release ready:
Add(redundant with 'Allow for other keyboard triggers')InteractiveFlag.cursorRotate
Consider renaming(InteractiveFlag.rotate
for clarityInteractiveFlag.cursorRotate
will not be added)Allow for customizing rotation degree scale (1 by default)(does not work correctly and can cause rotation jumps)Also moved
InteractionOptions.enableScrollWheel
toInteractiveFlags.scrollWheelZoom
with deprecation.